<?php
// +-------------------------------------------------------------------------------
// | DingZone [ A Rapid Development Framework For Dingtalk ]
// +-------------------------------------------------------------------------------
// | ExamController.php v1.0
// |
// | Copyright (c) 2014-2018 http://www.heimalanshi.com All rights reserved.
// | Author : rahul
// | Date : 2018/11/5
// +-------------------------------------------------------------------------------
namespace app\core\model;

use think\Db;

class CronTaskLog {

    public static function _q() {
        return Db::name("cron_task_log");
    }

    /**
     * 添加一条定时任务运行记录
     * @param $cronTaskId
     * @param $hostname
     * @param $opsServer
     * @param $gmtStarted
     * @param $gmtEnded
     * @param $escape
     * @param $result
     * @param $log
     * @return int|string
     */
    public static function add($cronTaskId, $hostname, $opsServer, $gmtStarted, $gmtEnded, $escape, $result, $log) {
        return self::_q()->insert([
            'cron_task_id' => $cronTaskId,
            'hostname' => $hostname,
            'ops_server' => $opsServer,
            'gmt_started' => $gmtStarted,
            'gmt_ended' => $gmtEnded,
            'escape' => $escape,
            'result' => $result,
            'log' => $log,
            'gmt_created' => time(),
            'gmt_modified' => time(),
            'is_deleted' => 0
        ]);
    }
}